home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 5_2007-2008.ISO / data / Zips / Score_Edit2060794162007.psc / Score Editor / modMidiDeclares.bas < prev    next >
BASIC Source File  |  2006-07-02  |  9KB  |  134 lines

  1. Attribute VB_Name = "modMidiDeclares"
  2. Public Const MAXPNAMELEN = 32             ' Maximum product name length
  3.  
  4. ' Error values for functions used in this sample. See the function for more information
  5. Public Const MMSYSERR_BASE = 0
  6. Public Const MMSYSERR_BADDEVICEID = (MMSYSERR_BASE + 2)     ' device ID out of range
  7. Public Const MMSYSERR_INVALPARAM = (MMSYSERR_BASE + 11)     ' invalid parameter passed
  8. Public Const MMSYSERR_NODRIVER = (MMSYSERR_BASE + 6)        ' no device driver present
  9. Public Const MMSYSERR_NOMEM = (MMSYSERR_BASE + 7)           ' memory allocation error
  10.  
  11. Public Const MMSYSERR_INVALHANDLE = (MMSYSERR_BASE + 5)     ' device handle is invalid
  12. Public Const MIDIERR_BASE = 64
  13. Public Const MIDIERR_STILLPLAYING = (MIDIERR_BASE + 1)      ' still something playing
  14. Public Const MIDIERR_NOTREADY = (MIDIERR_BASE + 3)          ' hardware is still busy
  15. Public Const MIDIERR_BADOPENMODE = (MIDIERR_BASE + 6)       ' operation unsupported w/ open mode
  16.  
  17. 'User-defined variable the stores information about the MIDI output device.
  18. Type MIDIOUTCAPS
  19.    wMid As Integer                   ' Manufacturer identifier of the device driver for the MIDI output device
  20.                                      ' For a list of identifiers, see the Manufacturer Indentifier topic in the
  21.                                      ' Multimedia Reference of the Platform SDK.
  22.    
  23.    wPid As Integer                   ' Product Identifier Product of the MIDI output device. For a list of
  24.                                      ' product identifiers, see the Product Identifiers topic in the Multimedia
  25.                                      ' Reference of the Platform SDK.
  26.    
  27.    vDriverVersion As Long            ' Version number of the device driver for the MIDI output device.
  28.                                      ' The high-order byte is the major version number, and the low-order byte is
  29.                                      ' the minor version number.
  30.                                      
  31.    szPname As String * MAXPNAMELEN   ' Product name in a null-terminated string.
  32.    
  33.    wTechnology As Integer            ' One of the following that describes the MIDI output device:
  34.                                      '     MOD_FMSYNTH-The device is an FM synthesizer.
  35.                                      '     MOD_MAPPER-The device is the Microsoft MIDI mapper.
  36.                                      '     MOD_MIDIPORT-The device is a MIDI hardware port.
  37.                                      '     MOD_SQSYNTH-The device is a square wave synthesizer.
  38.                                      '     MOD_SYNTH-The device is a synthesizer.
  39.                                      
  40.    wVoices As Integer                ' Number of voices supported by an internal synthesizer device. If the
  41.                                      ' device is a port, this member is not meaningful and is set to 0.
  42.                                      
  43.    wNotes As Integer                 ' Maximum number of simultaneous notes that can be played by an internal
  44.                                      ' synthesizer device. If the device is a port, this member is not meaningful
  45.                                      ' and is set to 0.
  46.                                      
  47.    wChannelMask As Integer           ' Channels that an internal synthesizer device responds to, where the least
  48.                                      ' significant bit refers to channel 0 and the most significant bit to channel
  49.                                      ' 15. Port devices that transmit on all channels set this member to 0xFFFF.
  50.                                      
  51.    dwSupport As Long                 ' One of the following describes the optional functionality supported by
  52.                                      ' the device:
  53.                                      '     MIDICAPS_CACHE-Supports patch caching.
  54.                                      '     MIDICAPS_LRVOLUME-Supports separate left and right volume control.
  55.                                      '     MIDICAPS_STREAM-Provides direct support for the midiStreamOut function.
  56.                                      '     MIDICAPS_VOLUME-Supports volume control.
  57.                                      '
  58.                                      ' If a device supports volume changes, the MIDICAPS_VOLUME flag will be set
  59.                                      ' for the dwSupport member. If a device supports separate volume changes on
  60.                                      ' the left and right channels, both the MIDICAPS_VOLUME and the
  61.                                      ' MIDICAPS_LRVOLUME flags will be set for this member.
  62. End Type
  63.  
  64. Declare Function midiOutGetNumDevs Lib "winmm" () As Integer
  65. ' This function retrieves the number of MIDI output devices present in the system.
  66. ' The function returns the number of MIDI output devices. A zero return value means
  67. ' there are no MIDI devices in the system.
  68.  
  69. Declare Function midiOutGetDevCaps Lib "winmm.dll" Alias "midiOutGetDevCapsA" (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long
  70. ' This function queries a specified MIDI output device to determine its capabilities.
  71. ' The function requires the following parameters;
  72. '     uDeviceID-     unsigned integer variable identifying of the MIDI output device. The
  73. '                    device identifier specified by this parameter varies from zero to one
  74. '                    less than the number of devices present. This parameter can also be a
  75. '                    properly cast device handle.
  76. '     lpMidiOutCaps- address of a MIDIOUTCAPS structure. This structure is filled with
  77. '                    information about the capabilities of the device.
  78. '     cbMidiOutCaps- the size, in bytes, of the MIDIOUTCAPS structure. Use the Len
  79. '                    function with the MIDIOUTCAPS variable as the argument to get
  80. '                    this value.
  81. '
  82. ' The function returns MMSYSERR_NOERROR if successful or one of the following error values:
  83. '     MMSYSERR_BADDEVICEID    The specified device identifier is out of range.
  84. '     MMSYSERR_INVALPARAM     The specified pointer or structure is invalid.
  85. '     MMSYSERR_NODRIVER       The driver is not installed.
  86. '     MMSYSERR_NOMEM          The system is unable to load mapper string description.
  87.  
  88. Declare Function midiOutClose Lib "winmm.dll" (ByVal hMidiOut As Long) As Long
  89. ' The function closes the specified MIDI output device. The function requires a
  90. ' handle to the MIDI output device. If the function is successful, the handle is no
  91. ' longer valid after the call to this function. A successful function call returns
  92. ' MMSYSERR_NOERROR.
  93.  
  94. ' A failure returns one of the following:
  95. '     MIDIERR_STILLPLAYING  Buffers are still in the queue.
  96. '     MMSYSERR_INVALHANDLE  The specified device handle is invalid.
  97. '     MMSYSERR_NOMEM        The system is unable to load mapper string description.
  98.  
  99. Declare Function midiOutOpen Lib "winmm.dll" (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
  100. ' The function opens a MIDI output device for playback. The function requires the
  101. ' following parameters
  102. '     lphmo-               Address of an HMIDIOUT handle. This location is filled with a
  103. '                          handle identifying the opened MIDI output device. The handle
  104. '                          is used to identify the device in calls to other MIDI output
  105. '                          functions.
  106. '     uDeviceID-           Identifier of the MIDI output device that is to be opened.
  107. '     dwCallback-          Address of a callback function, an event handle, a thread
  108. '                          identifier, or a handle of a window or thread called during
  109. '                          MIDI playback to process messages related to the progress of
  110. '                          the playback. If no callback is desired, set this value to 0.
  111. '     dwCallbackInstance-  User instance data passed to the callback. Set this value to 0.
  112. '     dwFlags-Callback flag for opening the device. Set this value to 0.
  113. '
  114. ' The function returns MMSYSERR_NOERROR if successful or one of the following error values:
  115. '     MIDIERR_NODEVICE-       No MIDI port was found. This error occurs only when the mapper is opened.
  116. '     MMSYSERR_ALLOCATED-     The specified resource is already allocated.
  117. '     MMSYSERR_BADDEVICEID-   The specified device identifier is out of range.
  118. '     MMSYSERR_INVALPARAM-    The specified pointer or structure is invalid.
  119. '     MMSYSERR_NOMEM-         The system is unable to allocate or lock memory.
  120.  
  121. Declare Function midiOutShortMsg Lib "winmm.dll" (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
  122. ' This function sends a short MIDI message to the specified MIDI output device. The function
  123. ' requires the handle to the MIDI output device and a message is packed into a doubleword
  124. ' value with the first byte of the message in the low-order byte. See the code sample for
  125. ' how to create this value.
  126. '
  127. ' The function returns MMSYSERR_NOERROR if successful or one of the following error values:
  128. '     MIDIERR_BADOPENMODE-  The application sent a message without a status byte to a stream handle.
  129. '     MIDIERR_NOTREADY-     The hardware is busy with other data.
  130. '     MMSYSERR_INVALHANDLE- The specified device handle is invalid.
  131.  
  132.  
  133.  
  134.